(function () {
    'use strict';

    angular
        .module('logcenterApp')
        .service('transerCountService',transerCountService);

    transerCountService.$inject=['$http','$q'];
    function transerCountService($http,$q) {

        //服务调用
        var queryCallServiceTop10 = function (partition,logmsg,beginDateTime, endDateTime,code,active) {
            var deferred=$q.defer();
            $http.get('api/dashboard/callServiceTop10?partition=' + partition+"&logmsg="+logmsg
                + '&startTime='+ beginDateTime + '&endTime=' + endDateTime+'&code='+code+"&active="+active).then(function (resp) {
                deferred.resolve(resp.data);
            },function (error) {
                deferred.reject(error);
            });
            return deferred.promise;
        };

        //用户调用
        var queryUidServiceTop10 = function (partition,logmsg,beginDateTime, endDateTime,code,active) {
            var deferred=$q.defer();
            $http.get('api/dashboard/uidServiceTop10?partition=' + partition
                + '&startTime='+ beginDateTime + '&endTime=' + endDateTime+'&code='+code+"&active="+active).then(function (resp) {
                deferred.resolve(resp.data);
            },function (error) {
                deferred.reject(error);
            });
            return deferred.promise;
        };

        var queryBatchServiceTop10 = function (partition,beginDateTime, endDateTime,code,active) {
            var deferred=$q.defer();
            $http.get('api/dashboard/batchServiceTop10?partition=' + partition
                + '&startTime='+ beginDateTime + '&endTime=' + endDateTime+'&code='+code+"&active="+active).then(function (resp) {
                deferred.resolve(resp.data);
            },function (error) {
                deferred.reject(error);
            });
            return deferred.promise;
        };

        var queryAsyncRouteServiceTop10 = function (partition,beginDateTime, endDateTime,code,active) {
            var deferred=$q.defer();
            $http.get('api/dashboard/asyncRouteServiceTop10?partition=' + partition
                + '&startTime='+ beginDateTime + '&endTime=' + endDateTime+'&code='+code+"&active="+active).then(function (resp) {
                deferred.resolve(resp.data);
            },function (error) {
                deferred.reject(error);
            });
            return deferred.promise;
        };

        var callFrameServiceTop10 = function (partition,beginDateTime, endDateTime,code,active) {
            var deferred=$q.defer();
            $http.get('api/dashboard/callFrameServiceTop10?partition=' + partition +
                '&startTime='+ beginDateTime + '&endTime=' + endDateTime+'&code='+code+"&active="+active).then(function (resp) {
                deferred.resolve(resp.data);
            },function (error) {
                deferred.reject(error);
            });
            return deferred.promise;
        };
        return {

            queryCallServiceTop10:queryCallServiceTop10,
            queryBatchServiceTop10:queryBatchServiceTop10,
            queryUidServiceTop10:queryUidServiceTop10,
            queryAsyncRouteServiceTop10:queryAsyncRouteServiceTop10,
            callFrameServiceTop10:callFrameServiceTop10
        };
    }
})();
